{extend name="homePage/userPage" /}
{block name="css"}
    <script type="text/javascript" src="__JS__/../../ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="__JS__/../../ueditor/ueditor.all.js"></script>
    <script type="text/javascript" src="__JS__/../../ueditor/lang/zh-cn/zh-cn.js"></script>
    <style type="text/css">
        .search li{
            float:left;
            /*text-decoration: none;*/
            list-style:none;
            margin: 1px 40px 5px 40px;
        }
        .test{
            border:5px solid red;
        }
    </style>
{/block}
{block name="main"}
    <div style="border:1px solid #ccc">

            <table class="table table-hover">
                <thead>
                      <tr>
                        <th>文件名</th>
                        <th>时间</th>
                        <th>类别</th>
                        <th>审核状态</th>
                        <!-- <th>归档类型</th> -->
                        <th>文件来源</th>
                        <th>目的部门</th>
                        <th>操作</th>
                      </tr>
                    </thead>
                    <tbody>
                        {if condition="$textlist neq ''"}
                            {volist name="textlist" id="vo" }
                            <tr>
                                <td>
                                    {$vo.textname}
                                </td>
                                <td>
                                    <?PHP echo date("Y-m-d ",$vo['asktime'])?>
                                </td>
                                <td>
                                    {if condition="$vo['type'] eq 0"}
                                        个人文件
                                    {elseif condition="$vo['type'] eq 1"/}
                                        部门内部文件
                                    {else /}
                                        部门交流文件
                                    {/if}
                                </td>
                                <td>
                                    {if condition="$vo['status'] eq 0"/}
                                        未审核
                                    {elseif condition="$vo['status'] eq 1"/}
                                        本部通过
                                    {elseif condition="$vo['status'] eq 2"/}
                                        本部未通过
                                    {elseif condition="$vo['status'] eq 3"/}
                                        待最终审核
                                    {elseif condition="$vo['status'] eq 4"/}
                                        审批完成
                                    {elseif condition="$vo['status'] eq 5"/}
                                        外部未通过
                                    {else /}
                                        已经归档
                                    {/if}
                                </td>

                                <td>
                                    {if condition="$vo['type'] neq 2"/}
                                        本部门
                                    {else /}
                                        <!--获取来源部门名称-->
                                        {foreach $classnamelist as $v}
                                            {if condition="$vo['askcid'] eq $v['id']"/}
                                                {$v.name}
                                            {/if}
                                        {/foreach}
                                    {/if}
                                </td>
                                <td>
                                    {if condition="$vo['type'] neq 2"/}
                                        本部门
                                    {else /}
                                        <!--获取目的部门名称-->
                                        {foreach $classnamelist as $v}
                                            {if condition="$vo['outcid'] eq $v['id']"/}
                                                {$v.name}
                                            {/if}
                                        {/foreach}
                                    {/if}
                                </td>
                                   
                                    <?php  $a ='name'.$vo['id'] ?>
                                    <td>
                                        <a href="{:url('Document/watchtext',['id'=>$vo.id])}" class="btn btn-success" >查看</a>
                                {if condition="$user['position'] neq '普通职员'"}
                                    {if condition="$vo['status'] eq 0 "}
                                        <a href="{:url('Document/eheckpass',['id'=>$vo.id,'status'=>$vo.status])}" class="btn btn-info " >通过审批</a>
                                        <p  class="btn btn-warning nopath " >拒绝审批</p>
                                    {elseif condition="$vo['status'] eq 1 and $vo['outcid'] eq $user['class']"/}
                                        <a href="{:url('Document/eheckpass',['id'=>$vo.id,'status'=>$vo.status])}" class="btn btn-primary " >通过审批</a>
                                        <p  class="btn btn-warning nopath "  >拒绝审批</p>
                                    <!--部门内部文件归档-->
                                    {elseif condition="$vo['status'] eq 1 and $vo['type'] neq 2"/}
                                        <p  class="btn btn-primary showclass" >归档</p>
                                    <!--部门之间文件归档-->
                                    {elseif condition="$vo['status'] eq 4 and $vo['outcid'] neq $user['class']"/}
                                        <p class="btn btn-primary showclass" >归档</p>
                                    {elseif condition="$vo['status'] eq 2 or $vo['status'] eq 5"/}
                                    <p  class="btn btn-warning showquestion" >查看原因</p>

                                    {elseif condition="$vo['status'] eq 1 and $vo['type'] eq 2 and $vo['outcid'] neq $user['class']"/}
                                        <p class="btn btn-danger showurge"  >催文</p>

                                    {/if}
                                {/if}
                                    </td>
                            </tr>
 <!--未通过原因输入框体-->
                            <tr class="asd ">
                                <td  colspan="7">
                                    <form action="{:url('Document/nopathinfo')}" method="post">
                                        <input type="hidden" name="id" value="{$vo['id']}">
                                        <input type="hidden" name="status" value="{$vo['status']}">
                                        未通过原因:
                                        <input type="text" name="question">
                                        <input type="submit" value="确认">
                                        <br>
                                    </form>
                                </td>
                            </tr>
 <!--未通过原因显示框体-->
                            <tr class="asd question1">
                                <td  colspan="7">
                                <h1>
                                未通过原因:
                                {$vo.question}</h1>
                                <br>
                                </td>
                            </tr>
<!--归档操作显示框体-->
                            <tr class="asd calssily">
                                <td  colspan="7">
                                <br>
                                <form action="{:url('Document/classify')}" method="post" align="center">
                                        <input type="hidden" name="id" value="{$vo['id']}">
                                        <input type="hidden" name="status" value="6">
                                        选择分类:
                                        <select name="tagid" id="">
                                            {foreach $taglist as $vvv}
                                            <option value="{$vvv.id}">{$vvv.tagname}</option>
                                            {/foreach}
                                        </select>
                                        是否加密
                                        <select name="isencrypt" id="">
                                            <option value="0">不加密</option>
                                            <option value="1">加密</option>
                                        </select>
                                        <input type="submit"value="确认">
                                        <br>
                                    </form>
                                <br>
                    
                                </td>
                            </tr>
<!--催文输入框体-->
                            <tr class="asd urgetext">
                                    <td  colspan="7">
                                        <form action="{:url('Document/addurge')}" method="post" align="center">
                                            <input type="hidden" name="id" value="{$vo['id']}">
                                            <input type="hidden" name="textname" value="{$vo['textname']}">
                                            <input type="hidden" name="outcid" value="{$vo['outcid']}">
                                            请输入信息:
                                            <textarea name="urgetext" id="" cols="30" rows="3"></textarea>
                                            <input type="submit" value="确认">
                                            <br>
                                        </form>
                                    </td>
                                </tr>
                            {/volist}
                        {else/}
                            <tr> <td colspan="6"><h1>暂无数据!</h1></td></tr>
                        {/if}
                    </tbody>
                    </table>


    </div>


{/block}
{block name="js"}
        <script type="text/javascript">
        //点击时候所有的asd 行全部为hidden 本行对应的显示

        $('.asd').hide();
        $('.nopath').click(function() {
            $('.asd').hide();
            $(this).parents('tr').next('tr').show();
        });
        $('.showquestion').click(function(){
        $('.asd').hide();
            $(this).parents('tr').next('tr').next('tr').show();
            // $(this).parents('tr').next('.question1').show();
        });
        $('.showclass').click(function(){
            $('.asd').hide();
            $(this).parents('tr').next('tr').next('tr').next('tr').show();
            // $(this).parents('tr').next('.question1').show();
        });
        $('.showurge').click(function(){
            $('.asd').hide();
            $(this).parents('tr').next('tr').next('tr').next('tr').next('tr').show();
            // $(this).parents('tr').next('.question1').show();
        });


        </script>
{/block}
